import com.xing.entity.pojo.Article;
import com.xing.entity.pojo.ArticleType;
import com.xing.entity.pojo.SystemUser;
import com.xing.entity.vo.ArticlePage;
import com.xing.entity.vo.AuthorityUser;
import com.xing.service.ArticleService;
import com.xing.service.SystemUserService;
import com.xing.service.impl.ArticleTypeServiceImpl;
import com.xing.service.impl.SystemFunctionServiceImpl;
import com.xing.service.impl.SystemUserServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.UUID;

public class Mytest {

    @Test
    public void test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        ArticleService articleService = context.getBean("articleServiceImpl", ArticleService.class);

        ArticlePage byPage = articleService.findByPage(1, 4,"新闻", (byte) 1);
        for (Article article : byPage.getList()) {
            System.out.println(article);
        }
    }

    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SystemFunctionServiceImpl systemFunctionServiceImpl = context.getBean("systemFunctionServiceImpl", SystemFunctionServiceImpl.class);
        for (AuthorityUser authorityUser : systemFunctionServiceImpl.findByRoleID("4444")) {
            System.out.println(authorityUser.getChildrenFunction());
        }

    }
    //蒲佳伟是煞笔
    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SystemUserService systemUserServiceImpl = context.getBean("systemUserServiceImpl", SystemUserService.class);
        SystemUser systemUser=new SystemUser();
        for (SystemUser user : systemUserServiceImpl.findAll(systemUser)) {
            System.out.println(user);
        }
    }

    @Test
    public void test4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        SystemFunctionServiceImpl systemFunctionServiceImpl = context.getBean("systemFunctionServiceImpl", SystemFunctionServiceImpl.class);
        for (AuthorityUser authorityUser : systemFunctionServiceImpl.findFunAll()) {

          if(authorityUser.getChildrenFunction().size()==0){
              System.out.println("ture");
          }
        }
    }




}
